Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-sfc): v-bind using // to comment will still compile #5409

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

eavan5
Copy link
Contributor

@eavan5 eavan5 commented Feb 11, 2022

When I use scss, if I write v-bind and comment it out, the v-bind line of css is still compiled as a css variable

Here is a default project I created using "@vue/cli 4.5.15"

<template>
  <div id="nav">
    <router-link to="/">Home</router-link>|
    <router-link to="/about">About</router-link>
  </div>
  <router-view />
</template>

<script setup>
const color =  "yellow"
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
  // background-color: v-bind(color); 

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>


The line is actually commented out by css, but the v-bind variables are still compiled into the styles of the nav tag

<div id="nav" style="--7ba5bd90-color:yellow;">
  ... 
</div>

iShot2022-02-11 23 17 53

Comments about sass

@netlify
Copy link

netlify bot commented Feb 11, 2022

✔️ Deploy Preview for vue-next-template-explorer ready!

🔨 Explore the source changes: 5cc64eb

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-next-template-explorer/deploys/62068188abf02a00073d49b8

😎 Browse the preview: https://deploy-preview-5409--vue-next-template-explorer.netlify.app

@netlify
Copy link

netlify bot commented Feb 11, 2022

✔️ Deploy Preview for vue-sfc-playground ready!

🔨 Explore the source changes: 5cc64eb

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-sfc-playground/deploys/62068188913dca0007adbb1a

😎 Browse the preview: https://deploy-preview-5409--vue-sfc-playground.netlify.app/

@netlify
Copy link

netlify bot commented Feb 11, 2022

❌ Deploy Preview for vuejs-coverage failed.

🔨 Explore the source changes: 5cc64eb

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-coverage/deploys/620681889b56b200084c0bba

@edison1105 edison1105 added scope: sfc-style-vars ready to merge The PR is ready to be merged. labels Feb 12, 2022
@haoqunjiang
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Feb 10, 2023

📝 Ran ecosystem CI: Open

suite result
nuxt ❌ failure
pinia ❌ failure
router ❌ failure
test-utils ❌ failure
vite-plugin-vue ❌ failure
vitepress ❌ failure

@sxzz
Copy link
Member

sxzz commented Jun 10, 2023

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Jun 10, 2023

📝 Ran ecosystem CI: Open

suite result
nuxt ❌ failure
pinia ✅ success
quasar ❌ failure
router ❌ failure
test-utils ❌ failure
vant ✅ success
vite-plugin-vue ✅ success
vitepress ❌ failure
vue-macros ❌ failure
vuetify ✅ success
vueuse ✅ success
vue-simple-compiler ✅ success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge The PR is ready to be merged. scope: sfc-style-vars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants